package com.yeban.base.day03;

/**
 * @Desc TODO
 * @Author yeban
 * @Date 2025/9/27
 */
public class For_work04 {

    public static boolean isNumber(int num) {
        // 判断是否为水仙花数
        int number = num;
        int temp = 0;
        int sum = 0;
        for (int i = 0; i < 3; i++) {
            temp = number % 10;
            sum += temp * temp * temp;
            number /= 10;
        }

        if (sum == num) {
            return true;
        }
        return false;
    }

    public static void main(String[] args) {

        int count = 0;
        for (int i = 100; i < 1000; i++) {
            if (isNumber(i)) {
                count ++;
            }
        }

        System.out.println("水仙花数一共：" + count + "个");
    }
}
